package com.yuye.cloud.common.model;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;

/**
 * 实体父类
 *
 * @author xgf
 */
@Setter
@Getter
public class SuperEntity<T extends Model<?>> extends Model<T> {
	/**
     * 主键ID
     */
    @TableId
    @ExcelIgnore
    private Long id;
    @TableField(fill = FieldFill.INSERT)
    @ExcelIgnore
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;
    
    @TableLogic
    @JsonIgnore
    @ExcelIgnore
    private Integer delFlag;

    @Version
    @JsonIgnore
    @ExcelIgnore
    private Integer version;
    /**
     * 数据权限
     */
    @TableField(exist = false)
    @JsonIgnore
    @ExcelIgnore
    private String dataScope;
    
	 @TableField(exist = false)
	 @JsonIgnore
	 @ExcelProperty(value = {"错误信息"})
	 private String errMsg;
	 
	 
	 @JsonIgnore
	 @TableField(fill = FieldFill.INSERT)
	 private String createUser;
	 
	 @JsonIgnore
	 @TableField(fill = FieldFill.INSERT_UPDATE)
	 private String updateUser;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
